import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class ClientLobbyDialog extends JDialog implements ActionListener {
    
    private JSClient client = null;
    private JPanel btn_panel = null;
    private JButton create_btn = null;
    private JButton join_btn = null;
    private JButton leave_btn = null;
    
    private JList session_list = null;
    private DefaultListModel session_listModel = null;
    
    public ClientLobbyDialog(Frame aFrame, JSClient parent) {
        super(aFrame, true);
        client = parent;
        setTitle("Connection Lobby");
        
        session_listModel = new DefaultListModel();
        session_listModel.addElement(new SessionInfo("Dave Brubeck Quartet", "dbru, pdes, bbates, jdodge", 1));
        session_list = new JList(session_listModel);
        
        this.add(session_list, BorderLayout.PAGE_START);
        
        btn_panel = new JPanel();
        create_btn = new JButton("Create session");
        join_btn = new JButton("Join session");
        leave_btn = new JButton("Leave session");
        btn_panel.add(create_btn);
        btn_panel.add(join_btn);
        btn_panel.add(leave_btn);
        this.add(btn_panel, BorderLayout.PAGE_END);
        this.pack();
        
        create_btn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                client.createSession("Default");
            }
        } );
    }
    
    public void actionPerformed(ActionEvent e) {
        
    }
}
